/*
 * @Author: YNT 2501512800@qq.com
 * @Date: 2022-05-20 22:13:52
 * @LastEditors: YNT 2501512800@qq.com
 * @LastEditTime: 2022-05-21 15:42:46
 * @FilePath: \22-03-19 智慧社区\api\enjoy.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import wxRequest from '../utils/wx-request'

class SpecialModel extends wxRequest {
  // 社区共享列表
  allEnjoyList() {
    return this.request({
      url: `/api/v1/shared/list`,
      method: 'GET',
    })
  }

  // 社区共享详情
  allEnjoyDetail(id) {
    return this.request({
      url: `/api/v1/shared?id=${id}`,
      method: 'GET',
    })
  }

  // 我的共享
  myEnjoyList() {
    return this.request({
      url: `/api/v1/shared/list/self`,
      method: 'GET',
    })
  }

  // 我的共享详情
  myEnjoyDetail(id) {
    return this.request({
      url: `/api/shared_community/manager/${id}/`,
      method: 'GET',
    })
  }

  // 新增我的共享
  addMyEnjoy(params) {
    return this.request({
      url: `/api/v1/shared`,
      method: 'PUT',
      params,
    })
  }

  // 更新我的共享
  updateMyEnjoy(id, params) {
    return this.request({
      url: `/api/v1/shared?id=${id}`,
      method: 'POST',
      params,
    })
  }

  // 共享轮播图
  enjoyBanners() {
    return this.request({
      url: `/api/v1/banners/list?type_id=2`,
      method: 'GET',
    })
  }

  // 删除共享
  deleteEnjoy(id) {
    return this.request({
      url: `/api/v1/shared?id=${id}`,
      method: 'DELETE',
    })
  }
}

export default new SpecialModel()
